#include<stdlib.h>
#include<stdio.h>
#include<string.h>




//定义每一个数据的节点
typedef struct my_node{
    char data;
    struct my_node *next;
}my_node,*p_node;

//定义队列
typedef struct{
    p_node front,rear;
}link_queue;


void init_queue(link_queue *p_queue)
{
    p_queue->front = p_queue->rear = (p_node)malloc(sizeof(my_node));
    if(!p_queue->front)
        exit(0);
    p_queue->front->next = NULL;
}

void insert_queue(link_queue *p_queue,char data)
{
    p_node add_node;
    add_node = (p_node)malloc(sizeof(my_node));
    add_node->data = data;
    add_node->next = NULL;
    p_queue->rear->next = add_node;
    p_queue->rear = add_node;
}

void delete_queue(link_queue *p_queue,char *data)
{
    p_node delete_node ;
    delete_node = p_queue->front->next;
    *data = delete_node->data;
    p_queue->front->next = delete_node->next;
    if(p_queue->rear == delete_node)
    {
        p_queue->rear = delete_node->next;
    }
    free(delete_node);
}
void removeElement(*head *val){
        // 为空
        if (head == null)
            return null;
        // 当不为空 且链表值等于给定值时
        while (head != null && head.val == val) {
            // 位移一位
            head = head.next;
        }
 
        ListNode node = head;
 
        while (node.next != null) {
            if (node.next.val == val)
                node.next = node.next.next;
            else
                node = node.next;
        }
        return head;
    }
}

int main(){
    link_queue *p_queue;
    p_queue = (link_queue *)malloc(sizeof(link_queue ); //如果编译问题 加
    init_queue(p_queue);

    for(int i=0;i<5;i++)
    {
        insert_queue(p_queue,('a'+i));
        removeElement(p_queue,('a'+i));
    }

    for(int i=0;i<5;i++)
    {
        char *my_data = (char*)malloc(sizeof(char));
        delete_queue(p_queue,my_data);
        printf("%c\\n",*my_data);

    }
    return 0;

}